import java.io.UnsupportedEncodingException;

public class RSAClient {

	public static void main(String args[]) {
		//Set up RSA object
		RSAObject rsa = new RSAObject();
		rsa.setKeyForEncyption(rsa.getMyPublicKey());
		
		//Choose message
		String message = "How are you?";
		
		//Encrypt message
		byte[] encrypted = null;
		String enc = null;
		try {
			//get byte stream of the encrypted message
			encrypted = rsa.encrypt(message);
			//convert the byte stream into readable characters (only for screen output)
			enc = new String(encrypted, "UTF8");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		//Decrypt message
		String decrypted = rsa.decrypt(encrypted);
		
		//Output results to verify
		System.out.println(message);
		System.out.println(enc);
		System.out.println(decrypted);
	}
	
}
